<template>
<van-tabbar v-model="active">
  <van-tabbar-item to="/home" icon="home-o">首页</van-tabbar-item>
  <van-tabbar-item to="/category" icon="points">分类</van-tabbar-item>
  <van-tabbar-item to="/cart" icon="shopping-cart-o">购物车</van-tabbar-item>
  <van-tabbar-item to="/personal" icon="user-o">个人中心</van-tabbar-item>
</van-tabbar>
</template>
<script>
export default {
  name: 'MyTabbar',
  computed: {
   active: {
      get() {
          switch (this.$route.path) {
          case '/home':
            return 0;
          case '/category':
            return 1;
          case '/cart':
            return 2;
          case '/personal':
            return 3;
          default:
            break;
        }
      },
      set() {
        
      }
    }
  }
}
</script>

<style>

</style>